package org.example.demo.Controller;

//import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.demo.ResponseHttps.ResponseData;
import org.example.demo.SQL.Dao.UserDao;
import org.example.demo.SQL.Models.APIUser;
import org.example.demo.SQL.Models.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@Tag(name = "用户管理", description = "用户相关操作")
@RequestMapping("/Knife4j")
public class Knife4jController {

    @Operation(summary = "获取用户列表", description = "返回所有用户的列表", tags = {"用户管理"})
    @GetMapping("/allUser")
    @ApiResponses(value = {
            // 返回code, 描述, 响应实体
            @ApiResponse(responseCode = "200", description = "成功", content = @Content(mediaType = "application/json",schema = @Schema(implementation = ResponseData.class))),
            @ApiResponse(responseCode = "400", description = "请求参数错误"),
            @ApiResponse(responseCode = "404", description = "找不到资源"),
            @ApiResponse(responseCode = "500", description = "服务器内部错误")
    })
    // 响应参数
    public ResponseData addUser() {
        Map<Integer, User> users = UserDao.findAllUsers();
        return new ResponseData("200", "查询成功", true, users);
    }

}